package file;

import java.io.File;
import java.util.Hashtable;
import java.util.Map;

/**
 * USER: lintc 【lintiancong@zhuojianchina.com】
 * DATE: 2017-05-02 11:16
 */
public class FileMain {
    public static Map<String, Integer> map = new Hashtable<>();
    public static void main(String[] args) {
        String fileName;
        fileName = "F:\\filet\\1.txt";
//        fileName = "C:\\Users\\ucmed\\Desktop\\20170427access.log\\home\\nginxlogs\\access.log.20170427";
        BigFileReader.Builder builder = new BigFileReader.Builder(fileName,new IHandle() {

            @Override
            public void handle(String line) {
//                String url = line.substring(0, line.indexOf(" "));
//                System.out.println(url);
//                Integer num = map.get(url);
//                if (null == num) {
//                    map.put(url, 1);
//                } else {
//                    map.put(url, num + 1);
//                }
            }
        });
        builder.withTreahdSize(10)
                .withCharset("gbk")
                .withBufferSize(1024 * 1024);
        BigFileReader bigFileReader = builder.build();
        bigFileReader.start();
//        File file = new File("");
//        file.listFiles();
    }
}
